﻿#ifndef __SS_RB_TREE_NODE_H__
#define __SS_RB_TREE_NODE_H__

#define SS_RBT_RED		false
#define SS_RBT_BLACK	true

namespace StarSeeker
{

template<typename N_KEY>
class ssRBTreeNode
{
	template<typename T_KEY, typename T_POOL> friend class ssRBTree;
public:
	ssRBTreeNode(void)
	{
		m_parent = 0;
		m_left = 0;
		m_right = 0;
		m_color = SS_RBT_RED;
		m_pOnwer = 0;
	}

	//获取父节点
	ssRBTreeNode* Parent()
	{
		return m_parent;
	}
	//获取左子
	ssRBTreeNode* Left()
	{
		return m_left;
	}
	//获取右子
	ssRBTreeNode* Right()
	{
		return m_right;
	}
	//是否黑色
	bool ColorIsBlack()
	{
		return m_color;
	}
	//
	const N_KEY & GetKey() const
	{
		return m_key;
	}
	void* Onwer()
	{
		return m_pOnwer;
	}
private:
	ssRBTreeNode*		m_parent;	//父节点
	ssRBTreeNode*		m_left;		//左子节点
	ssRBTreeNode*		m_right;	//右子节点
	bool				m_color;	//是否黑色
	N_KEY				m_key;
	void*				m_pOnwer;	//所在容器
};

}
#endif
